//== GAIA ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"
#include "sagittarius/patterns/radixtree.h"
#include "sagittarius/io/io.h"

#include <stdio.h>
#include <malloc.h>
#include <assert.h>
#include <string.h>

int main(int argc, char* argv[])
{
    #define STR_NUM 7
    //From Wikipedia
    char* str[STR_NUM] = {"romane", "romanus", "romulus", "rubens", "ruber", "rubicon", "rubicundus"};
    UnicodeCChar* ustr[STR_NUM];
    radixnode* root;
    size_t i;
    
    root = create_radix_root();
    
    for(i=0; i<STR_NUM; ++i) {
        //printf("len of str[i]: %lu\n", strlen(str[i]));
        ustr[i] = malloc((strlen(str[i])+1)*4);
        AN(ustr[i]);
        UTF8_ConvertBuffer(str[i], ustr[i]);
        
        AZ(radix_search_and_add(root, ustr[i], NULL));
        
        free(ustr[i]);
    }
    
    
    dump_radix_node(1, root, 0);
    
    destroy_radix_node(root);
    
    return 0;
}
